#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

typedef int32_t s32;
typedef int16_t s16;
typedef int8_t  s8;

typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t  u8;


typedef struct{
    s32 offset; //扇区偏移
    s32 size;   //占用大小，字节单位
}res_table_t;

typedef struct{
    u32 id;
    s32 num;
    s32 size;
    s32 zero;
    s32 skip[6];
    res_table_t table[0];
}res_t;


static void* fdata(const char*fn){
    FILE*f = fopen(fn,"rb");
    if(!f) return 0;
    fseek(f,0,SEEK_END);
    int sz = ftell(f);
    void*d = calloc(1,sz);
    fseek(f,0,SEEK_SET);
    fread(d,1,sz,f);
    fclose(f);
    return d;
}

static void proc_res(uint8_t*data){
    res_t*res = (res_t*)data;
    res_table_t *base = res->table;
    int i = 0;
    for(i=0;i<70;i++){
        res_table_t *t = base + i;
        const char*str = data + (t->offset * res->size);
        str += 0x70;
        fprintf(stdout,"(%d)%s",i,str);
        fprintf(stdout,"\n");
    }
    return 0;
}

int main(int argc,char**argv){
    if(argv[1]){
        uint8_t *data = fdata(argv[1]);
        if(data){
            proc_res(data);
            free(data);
            return 0;
        }
    }
    fprintf(stderr,"open file error\n");
    return -1;
}
